<template>
  <dialog-box
    :isDialog="false"
    ref="myDialog"
    :showFooter="true"
    width="600px"
    cacelName="关闭"
    @close="close"
    :isFooterSlot="true"
    :isShowSave="false"
    title="详情"
  >
    <template v-slot:dialogMain>
      <div>
        <el-form
          ref="ruleFormRef"
          :model="ruleForm"
          label-width="180px"
          class="demo-ruleForm"
          size="default"
          status-icon
        >
          <el-form-item label="下载任务名称" prop="name">
            <div>{{ruleForm.name || ''}}</div>
          </el-form-item>
          <el-form-item label="下载任务说明" prop="name">
            <div>{{ruleForm.name || ''}}</div>
          </el-form-item>
          <el-form-item label="取数类型" prop="name">
            <div>{{ruleForm.name || ''}}</div>
          </el-form-item>
          <el-form-item label="取数状态" prop="name">
            <div>{{ruleForm.name || ''}}</div>
          </el-form-item>
        </el-form>
      </div>
    </template>
  </dialog-box>
</template>

<script setup lang="ts">
import dialogBox from "@/components/dialog-box/index.vue";
import { reactive, toRefs, ref } from "vue";
import type { FormInstance } from "element-plus";
const myDialog = ref(null);

const ruleFormRef = ref<FormInstance>();

const ruleForm = reactive({
  name: "",
});

// 定义完成后，用defineExpose()暴露给父组件
const open = (row: any) => {
  for (const key in row) {
    if (Object.prototype.hasOwnProperty.call(ruleForm, key)) {
      ruleForm[key] = row[key];
      
    }
  }
  myDialog.value.handleOpen();
};
const close = () => {
  resetForm();
  myDialog.value.handleClose();
};
defineExpose({
  open,
  close,
});


const resetForm = () => {
  if (!ruleFormRef) return;
  ruleFormRef.value?.resetFields();
};
</script>

<style scoped>
h2 {
  margin-bottom: 20px;
}
.mb-20 {
  margin-bottom: 20px;
}
.mr-10 {
  margin-right: 10px;
}
.ml-10 {
  margin-left: 10px;
}
.steps-box {
  width: 300px;
  margin: 0 auto 30px;
}
.title-box {
  display: flex;
  align-items: center;
}
.seach-box {
  display: flex;
  padding: 0 10px;
  box-sizing: border-box;
}
.footer-btns {
  width: 100%;
  display: flex;
  justify-content: center;
}
</style>
